#if !defined(SM__SPRITE_H)
#define SM__SPRITE_H

#include "swagme.h"
#include "Effect.h"
#include <map>
#include <vector>
#include <string>

class Sprite {
  public:
    Sprite();
    Sprite(const char *file, const char *shadow=NULL, map<string, Effect *> *effects = NULL);
    ~Sprite();
    // draws the given frame of the given animation on the given surface at the given position
    int Draw(int animationIndex, int frameIndex, SDL_Surface *dst, int x, int y, bool bShadow=false);
    int getNumAnimations() const { return mnNumAnimations; }
    int getNumFrames() const { return mnNumFrames; }
    char *SpriteImageFile; // image file to load sprite surface from
    char *ShadowImageFile; // image file to load sprite shadow surface from
    Effect *getEffect(const string& name);
    // int AddEffect(const string &name); // apply the effect to the sprite
    // int RemoveEffect(const string &name); // stop drawing the named effect on this sprite
    int DrawEffect(int animationIndex, int frameIndex, SDL_Surface *dst, int x, int y, const string &effectName);
  private:
    map<string, Effect *> *mpEffects; // Effects are actually all in a collection owned by Game, this is just a pointer to it
    typedef map<string, Effect *>::iterator EffectIter;
    SDL_Surface *pSpriteSurface; // surface with all frames of the sprite
    SDL_Surface *pShadowSurface; // surface with all frames of the sprite
    SDL_Rect Frame; // rect for the current frame

    int mnNumFrames;
    int mnNumAnimations;
    int Blit(SDL_Surface *dst, int x, int y, SDL_Surface *pSourceSurface);
};

#endif // SM__SPRITE_H
